<?php
/**
 * Created by PhpStorm.
 * User: edmmss
 * Date: 2018/11/8
 * Time: 15:14
 */

namespace app\modules\builder\builderFactory;

use app\modules\builder\parts\Truck;
use app\modules\builder\parts\Door;
use app\modules\builder\parts\Engine;
use app\modules\builder\parts\Vehicle;
use app\modules\builder\parts\Wheel;

/**
 * Class TruckBuilder
 * @package app\modules\builder\builderFactory
 */
class TruckBuilder extends AbstractBuilder
{
    /**
     * @var Truck
     */
    public $truck;

    /**
     * className
     *
     * @date   2018/11/8
     * @author edmmss
     * @return mixed
     */
    public function createVehicle()
    {
        // TODO: Implement createVehicle() method.
        $this->truck = new Truck();
    }

    /**
     * className
     *
     * @date   2018/11/8
     * @author edmmss
     * @return mixed
     */
    public function addWheel()
    {
        // TODO: Implement addWheel() method.
        $this->truck->setPart('wheel1', new Wheel());
        $this->truck->setPart('wheel2', new Wheel());
    }

    /**
     * className
     *
     * @date   2018/11/8
     * @author edmmss
     * @return mixed
     */
    public function addEngine()
    {
        // TODO: Implement addEngine() method.
        $this->truck->setPart('engine1', new Engine());
        $this->truck->setPart('engine2', new Engine());
    }

    /**
     * className
     *
     * @date   2018/11/8
     * @author edmmss
     * @return mixed
     */
    public function addDoors()
    {
        // TODO: Implement addDoors() method.
        $this->truck->setPart('door1', new Door());
        $this->truck->setPart('door2', new Door());
    }

    /**
     * className
     *
     * @date   2018/11/8
     * @author edmmss
     * @return mixed
     */
    public function getVehicle(): Vehicle
    {
        // TODO: Implement getVehicle() method.
        return $this->truck;
    }
}